#!/usr/bin/env bash
# ******************************************************
# Author       : kklinux
# Last modified: 2019-07-31 03:10
# Email        : kklinux@126.com
# Filename     : time.sh
# Description  : 
# ******************************************************
function date_new() {
	curl -s https://time.is/zh/China|grep 'id="twd"' &>/tmp/new.date
	dater=$(cat /tmp/new.date |grep -o "[0-9]\{4,4\}年[0-9]\{1,2\}月[0-9]\{1,2\}日")
	echo -e "\e[35m网络日期为：$dater\e[0m"
	rm -rf /tmp/new.date
}

function time_new() {
	curl -s https://time.is/zh/China|grep 'id="twd"' &>/tmp/new.date
	timer=$(cat /tmp/new.date |grep -o "[0-9]\{1,2\}\:[0-9]\{1,2\}\:[0-9]\{1,2\}")
	echo -e "\e[35m网络时间为：$timer\e[0m"
	rm -rf /tmp/new.date
}

function run() {
	date_new
	time_new
}


run
